/*
 * @Descripttion: 
 * @version: 
 * @Author: guangyunl
 * @Date: 2024-01-19 22:32:08
 * @LastEditors: guangyunl
 * @LastEditTime: 2024-04-01 16:08:59
 */
/* indent size: 2 */

module.exports = app => {
  const DataTypes = app.Sequelize;

  const Coupons = app.model.define('coupons', {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
      comment: '优惠券id'
    },
    title: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: '优惠券标题'
    },
    price: {
      type: DataTypes.DECIMAL(10, 2),
      allowNull: true,
      comment: '优惠券金额'
    },
    type: {
      type: DataTypes.INTEGER(11),
      allowNull: true,
      comment: '优惠券类型【0-打折，1-直减】'
    },
    end_time: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: '优惠券过期时间'
    },
    createdAt: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: '创建时间'
    },
    updatedAt: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: '更新时间'
    }

  }, {
    tableName: 'coupons'
  });

  Coupons.associate = function () {
    
  }

  return Coupons;
};
